home *** CD-ROM | disk | FTP | other *** search
- Path: sn.no!usenet
- From: jan-henrik.haukeland@fou.telenor.no (jan-henrik haukeland)
- Newsgroups: comp.lang.c
- Subject: Re: How to tell if a file exists in C
- Date: 07 Feb 1996 23:54:58 +0100
- Organization: LH*281263
- Message-ID: <m2buna4ugt.fsf@hawk.no>
- References: <4eqkj6$ipo@charm.magnus.acs.ohio-state.edu>
- <m2pwbuvfb9.fsf@hawk.no> <823627565snz@genesis.demon.co.uk>
- NNTP-Posting-Host: nm2-ppp12.oslo.net
- In-reply-to: Lawrence Kirby's message of Tue, 06 Feb 96 17:26:05 GMT
- X-Newsreader: Gnus v5.0.12
-
- Lawrence Kirby writes:
-
- : jan-henrik.haukeland@fou.telenor.no "jan-henrik haukeland" writes:
- :
- : >Use the stat function, e.g.:
- : >
- : >int fexist(char * filename)
-
- <snip>
-
- : This function returns 3 distinct values. As such it does not return a
- : voolean-like quantity. Therefore it is highly misleading to label two of
- : those return values as TRUE and FALSE - you should find some more
- : appropriate names.
-
- Should I ? Lets see, either the file exist or it don't - Yes. Normal usage
- of this function would be, something like:
-
- if ( ! fexist(filename)) {
- /* Do stuff */
- }
-
- See, either it exist or it don't - and thats Boolean. But as a special
- "fyzzy logic" service, it will distinguish between TRUE, because even if it
- is TRUE that it exist, it's maybe not so true as You would like it to be,
- because it's NOT_A_REGULAR_FILE (i.e. a dir. a /dev ..). It is then
- possible to test for this. Beside did I say it was a boolean function, I
- think not.
-
- : -----------------------------------------
- : Lawrence Kirby | fred@genesis.demon.co.uk
- : Wilts, England | 70734.126@compuserve.com
- : -----------------------------------------
-
-
- jhh
-